In a prior art computer with microprogramming, the control section or such a computer generally is provided with an autonomous read-only storage. Each time a program instruction begins, the control unit generates an address to its read-only storage derived from the function or operation code of the instruction. This address locates what may be the first of a series of words which supply the control signals to the computer for carrying out the particular instruction being processed. Each instruction in effect generates a transfer to a microsubroutine associated with it, and the resultant step-by-step operation of the machine corresponds to the execution of a program on a very detailed level.
In such a computer in the prior art, program instructions generally comprise an operation code, i.e., the opcode, together with information relative to the location of the operands, that is, the data to be operated on. These operands sometimes may also have additional operational information. The length of the program instructions may be relatively long or relatively short depending on the quantity of data involved. The operating codes generally indicate the operation to be performed. Once the length of the operating code is established, it is possible to have only a certain fixed set of different operating codes and related program instructions. However, not all the operating codes which may theoretically be expressed with a certain number of bits, i.e., operating codes within the fixed set, are used to characterize program instructions for which the computer is provided with microprogramming resources. Generally, only a part or subset is used, and thus programming efficiency is degraded.
Also in a prior art computer, the memory of the computer provides the largest hardware cost. Therefore, the key to hardware speed and minimum size lies in efficient use of the memory. Fixed instruction length computers require the same number of bits for each instruction word regardless of the simplicity or complexity of the operation to be executed. As an example, many bits can be wasted in instructions which specify simple operations, while many instructions can be wasted in complex operations where an instruction's capability is limited by its length. Therefore, it is desired to design a computer with an instruction set which can perform all applications most efficiently.
To increase the efficiency of microprogramming in the prior art, the concept of optimizing compilers is used and implemented (1) to compile programming languages down to instructions that are as unencumbered as microinstructions in a large virtual address space and (2) to make the instruction cycle time as fast as the technology would allow. Computers having such optimized compilers are designed to have fewer instructions than those in the prior art, and what few instructions they do have are simple and would generally execute in one cycle. Such computers have been aptly named reduced instruction set computers (RISCs). Instructions that are part of a reduced instruction set in a RISC machine and that provide increased efficiency in a novel way have been invented and are described herein.
Specifically, one of the most common operations performed on a computer is moving a string of bytes, or words, from one address to another in memory. Because of the frequency of this operation, it is important to make it efficient. But because of the diversity in the exact form of the operation, diversity of fixed or variable lengths and addresses and diversity of lengths and alignments, it is difficult to find a uniform mechanism to perfom this operation efficiently, even though in practice very few of the variations may be used with any frequency.
In the prior art, one approach has been to specify one or two instructions that move bytes from a source to a destination. The options available, however, are very limited; so are the specifications of operands. Because of the number of options that has to be specified, i.e., addresses and lengths, the instructions in the set are very large. These instructions require several cycles to execute and assorted microcodes to control. Because of the long execution times, problems of these operations being locked out because of input/output (I/O) interruptions occur frequently. Therefore, these operations further need to be interruptable and/or restartable. This need obviously adds to the complexity of the instructions.
Furthermore, a similar problem occurs in a virtual memory system because of the long execution times. There, the problem of page faults occur instead of those of interrupts. The control necessary to solve these problems add cost and complexity to the hardware.
In short, additional complexity in data paths and controls for optimizing the execution of such operations, even if only to optimize operations of the most frequently occurring variations, is unavoidably introduced. Alternatively, a nonhardware support approach can be used to solve these problems. In such a situation, however, the operations would result in unacceptably long execution times.
In accordance with the preferred embodiment of the invention, a basic instruction for moving a string of bytes has been devised to solve these problems. Because the operations in the instruction are basic, very few variations are necessary to accommodate diversity of lengths and variables. Instruction for these operations are imbedded in a code sequence; the compiler can therefore generate exactly the minimum sequence necessary to perform the operations and can precompute many of the operands at compile time. The control necessary to optimize the operations is then in the compiler instead of the hardware, thereby avoiding the above-enumerated disadvantage of a hardware approach solution. As a consequence of all these factors, the instruction is implemented as a single-cycle operation. In other words, another instruction can be initiated within one cycle of the previous instruction without any impediment or "lockout.